package com.woniuxy.patrol.service;

import com.woniuxy.common.utils.ResponseUtil;
import com.woniuxy.patrol.pojo.PatrolTask;
import com.baomidou.mybatisplus.extension.service.IService;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;

/**
* @author 13162
* @description 针对表【wcm_patrol_task(巡更任务表)】的数据库操作Service
* @createDate 2025-07-18 17:19:00
*/
public interface PatrolTaskService extends IService<PatrolTask> {

    PatrolTask getById(Long taskId);

    // 生成当日巡更任务（XXL-JOB调用）
    ResponseUtil generateDailyTasks();

    // 更新任务状态（回调接口）
    ResponseUtil updateTaskStatus(Long taskId, Integer status, String remark);

    // 查询当日任务
//    List<PatrolTask> getTodayTasks();

    // 计算任务完成率
    ResponseUtil calculateCompletionRate(Long taskId);

    void checkAndUpdateExpiredTasks();

    ResponseUtil getTaskStats(LocalDate statDate, Long communityId);

    ResponseUtil checkCanGenerateTodayTasks(Long communityId);

    List<PatrolTask> getTodayTasks(Map<String, Object> params);

    long countTodayTasks(Map<String, Object> params);

    // 新增：统计符合条件的任务总数
    int countTodayTasks(Long communityId);

    int countTodayCompletedTasks(Long communityId);
}
